package cn.lu.train.net.interceptor;

import java.io.IOException;

import cn.lu.train.App;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Created by luxianyue on 2018/3/14.
 */

public class DynamicHostInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request()
                .newBuilder()
                .addHeader("userId", String.format("%s", App.getUserId()))
                .addHeader("token", App.getUserToken() + "")
                .build();
        /*if (mHost != null) {
            HttpUrl url = request.url()
                    .newBuilder()
                    .host(mHost)
                    .build();
            request.newBuilder()
                    .url(url)
                    .build();
            //mHost = null;
        }*/
        return chain.proceed(request);
    }
}
